/*********************************************************************************
  *Copyright(C),1996-2022,ChenJiehong
  *FileName:  filter_avg.h
  *Author:  ChenJiehong
  *Version:  V1.0
  *Date: 2023-04-23
**********************************************************************************/

#ifndef  __filter_avg_H__
#define  __filter_avg_H__

/***************************************Includes***********************************/
 #include "stdint.h"


/***************************************Macros***********************************/
#define C_FILTER_BUFF_SIZE					8U





/***************************************Variables***********************************/
typedef struct{
  uint16_t u16CurrentCode;
  uint16_t u16Sum;
  uint16_t u16Buff[C_FILTER_BUFF_SIZE];
  uint16_t u16Oldest;
  uint16_t u16Avg;
}Filter_t;


/***************************************Functions***********************************/
void filter_init(Filter_t *filter);
void filter_cal_avg(uint16_t original, uint16_t newData, Filter_t *Filter);

#endif
/* [] END OF filter_avg.h */
